﻿<ResourceDictionary 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:controls="clr-namespace:System.Controls">

  <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="Common.xaml"/>
  </ResourceDictionary.MergedDictionaries>

  <ControlTemplate x:Key="controlTemplate" TargetType="controls:TextLabel">

    <Border 
      SnapsToDevicePixels="true"
      CornerRadius="{TemplateBinding CornerRadius}"
      BorderBrush="{TemplateBinding BorderBrush}" 
      BorderThickness="{TemplateBinding BorderThickness}" 
      Background="{TemplateBinding Background}"  >
      <ContentPresenter 
        RecognizesAccessKey="True" 
        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
        SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
        VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
        <ContentPresenter.Content>
          <TextBlock
            Margin="{TemplateBinding Padding}"
            Text="{TemplateBinding Content}" 
            TextAlignment="{TemplateBinding TextAlignment}"
            TextWrapping="{TemplateBinding TextWrapping}"/>
        </ContentPresenter.Content>
      </ContentPresenter>
    </Border>

    <ControlTemplate.Triggers>
      <Trigger Property="IsEnabled" Value="false">
        <Setter Property="Opacity" Value="0.66"/>
      </Trigger>

    </ControlTemplate.Triggers>

  </ControlTemplate>

  <Style TargetType="controls:TextLabel" BasedOn="{StaticResource {x:Type Control}}">

    <Setter Property="Focusable" Value="False"/>
    <Setter Property="IsTabStop" Value="False"/>
    <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
    <Setter Property="Template" Value="{StaticResource controlTemplate}"/>
  </Style>

</ResourceDictionary>